package com.java.example.app

import android.content.Context
import android.os.Handler

/**
 * Created by chenll on 2024/8/22 0022.
 */
object Latte {
    fun init(context: Context): Configurator {
        configurator = Configurator.getInstance()
        Configurator.latteConfigs[ConfigKeys.APPLICATION_CONTEXT] = context.applicationContext
        return configurator
    }

    lateinit var configurator: Configurator

    @JvmStatic
    fun <T> getConfiguration(key: Any): T? {
        return configurator.getConfiguration(key)
    }

    @JvmStatic
    val applicationContext: Context
        get() = getConfiguration(ConfigKeys.APPLICATION_CONTEXT)!!

    @JvmStatic
    val handler: Handler
        get() = getConfiguration(ConfigKeys.HANDLER)!!

}
